From 6ce2329f5ce20f8352e3ea15594f2532ab8a392c Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Wed, 6 Dec 2023 19:50:56 -0500 Subject: Reimbursements --- src/app/groups/[groupId]/reimbursement-list.tsx | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/app/groups/[groupId]/reimbursement-list.tsx (limited to 'src/app/groups/[groupId]/reimbursement-list.tsx') diff --git a/src/app/groups/[groupId]/reimbursement-list.tsx b/src/app/groups/[groupId]/reimbursement-list.tsx new file mode 100644 index 0000000..9d3ec49 --- /dev/null +++ b/src/app/groups/[groupId]/reimbursement-list.tsx @@ -0,0 +1,31 @@ +import { Reimbursement } from '@/lib/balances' +import { Participant } from '@prisma/client' + +type Props = { + reimbursements: Reimbursement[] + participants: Participant[] + currency: string +} + +export function ReimbursementList({ + reimbursements, + participants, + currency, +}: Props) { + const getParticipant = (id: string) => participants.find((p) => p.id === id) + return ( +
+ {reimbursements.map((reimbursement, index) => ( +
+
+ {getParticipant(reimbursement.from)?.name} owes{' '} + {getParticipant(reimbursement.to)?.name} +
+
+ {currency} {reimbursement.amount.toFixed(2)} +
+
+ ))} +
+ ) +} -- cgit v1.3